<template>
	<view>
		<view class="top">
			<view class="up">
				<view class="left">
					<view class="text" @click="manorTicketNumber">
						总数
						<view class="ming" @click="toPage('detail')">
							查看明细
						</view>
					</view>
					<view class="number">
						{{jindoujuan}}
					</view>
				</view>
				<view class="right">
					<view class="list" v-for="(item,index) in dataList" :key="index">
						<view class="icon"></view>
						<image :src="img_pre+ item.transparent_logo" mode=""></image>
						<view class="name">
							{{item.title}}
						</view>
						<view class="number">
							{{item.number}} <text>张</text>
						</view>
					</view>
					<!-- <view class="list" @click="toPage('list')">
						<image src="../static/jindou3.png" mode=""></image>
						<view class="name">
							历史记录
						</view>
					</view>
					<view class="list" @click="toPage('exchange')">
						<image src="../static/jindou1.png" mode=""></image>
						<view class="name">
							兑换
						</view>
					</view> -->
				</view>
			</view>
		</view>
		<view class="content">
			<view class="title">
				兑换专区
			</view>
			<view v-if="list.length>0">
				<view class="list" @click="toPage(item.url)" :style="'background:'+item.color "
					v-for="(item,index) in list" :key="index">
					<image class="img" :src="'../static/'+item.img+'.png'"></image>
					<view class="con">
						<view class="name">
							{{item.name}}
						</view>
						<view class="text">
							{{item.text}}
						</view>
					</view>
					<image class="go" src="/static/image/a6.png" mode=""></image>
				</view>
			</view>
			<view class="none" v-else>
				<view class="none-view">
					<image src="../../../static/image/none.png" class="none-image"></image>
					<view class="none-name">
						暂无相关数据~
					</view>
				</view>
			</view>
		</view>
		<u-popup v-model="showBalance" close-icon-pos="top-left" :closeable="true" borderRadius="10" mode="bottom">
			<view class="balance">
				<view class="up">
					<view class="title">
						余额
					</view>
					<view class="list" :class="(index+1)%2!=0?'active':''" v-for="(item,index) in dataList"
						:key="index">
						<view class="left">
							{{item.title}}
						</view>
						<view class="right">
							{{item.number}}
						</view>
					</view>
				</view>
				<view class="down">
					<u-button type="primary" shape="circle" @click="showBalance=false" class="b1">我知道了</u-button>
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	var than;
	export default {
		data() {
			return {
				background: {
					'background': '#EFE1CC'
				},
				showBalance: false,
				jindoujuan: "",
				needguomi: "",
				needjindou: "",
				page: 1,
				dataList: [],
				list: [{
					name: "兑换蜂巢",
					text: "每日12:00-13:00开场",
					color: "linear-gradient(-52deg, #F3F9F9, #F3F9F9);",
					img: "s1",
					go: "s3",
					url: "manor"
				}, {
					name: "兑换会员卡",
					text: "会员卡福利多多",
					color: "linear-gradient(-52deg, #F5F6FA, #F5F6FA);",
					img: "s2",
					go: "s4",
					url: "/pages/htmlB/vip/index?type=Ghy"
				}],
			}
		},
		onLoad(option) {
			than = this;
			than.manorTicketNumber();
			/* than.post("api/Goldbean/gdbTicketNumber", null, function(data) {
				than.jindoujuan = data.jindoujuan;
				than.needguomi = data.needguomi;
				than.needjindou = data.needjindou;
			}) */
		},
		onShow() {},
		methods: {

			manorTicketNumber() {
				than.post("api/goldbean/manorTicketNumber", null, function(data) {
					than.dataList = data.manorList;
					3
					than.jindoujuan = data.number
				})
			}
		}
	}
</script>

<style lang="less">
	.balance {
		border-radius: 10rpx;

		.up {
			background: #FFFFFF;
			margin: auto;
			border-radius: 10rpx;

			.title {
				height: 111rpx;
				line-height: 111rpx;
				text-align: center;
				border-bottom: 2rpx solid #F6F6F6;
				font-size: 32rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #333333;
				margin-bottom: 48rpx;
			}

			.active {
				background: #E9F0FD;
				color: #06185C !important;
			}

			.list {
				height: 66rpx;
				display: flex;
				align-items: center;
				width: 418rpx;
				margin: auto;
				font-size: 24rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #1382F4;

				.left {
					padding-left: 61rpx;
				}

				.right {
					margin-left: auto;
					padding-right: 61rpx;
				}
			}
		}

		.down {

			height: 179rpx;
			display: flex;
			align-items: center;
			justify-content: center;

			.b1 {
				width: 245rpx;
				height: 74rpx;
				background: #FB683D;
				border-radius: 20rpx;
				font-size: 28rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #FFFFFF;
			}
		}
	}

	.top {
		width: 678rpx;
		background: linear-gradient(-52deg, #FFFFFF, #FFF6E5);
		border-radius: 12rpx;
		padding: 0 36rpx;
		margin: auto;

		.up {
			display: flex;
			align-items: center;
			height: 100%;
			width: 100%;

			.left {
				.number {
					font-size: 84rpx;
					font-family: DIN Medium;
					font-weight: 400;
					color: #FB683D;
				}

				.text {
					font-size: 26rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #333333;
					display: flex;
					align-items: center;

					.ming {
						margin-left: 20rpx;
						font-size: 22rpx;
						font-family: PingFang SC;
						font-weight: 500;
						display: flex;
						align-items: center;
						justify-content: center;
						color: #FFFFFF;
						width: 115rpx;
						height: 42rpx;
						background: linear-gradient(-90deg, #FFB456, #FE8657);
						box-shadow: 0px 3rpx 10rpx 0px rgba(255, 180, 86, 0.6);
						border-radius: 21rpx
					}
				}
			}

			.right {
				margin-left: auto;


				.list {
					text-align: center;
					margin-left: 45rpx;
					display: flex;
					align-items: center;
					height: 63rpx;

					image {
						width: 30rpx;
						height: 30rpx;
						margin: 0 5rpx;
					}

					.icon {
						width: 14rpx;
						height: 14rpx;
						background: #497EF5;
						border-radius: 50%;
					}

					.name {
						margin: 0 15rpx;
						font-size: 24rpx;
						font-family: PingFang SC;
						font-weight: bold;
						color: #4B76F6;
					}

					.number {
						margin-left: 10rpx;
						font-size: 32rpx;
						font-family: Myriad Pro;
						font-weight: 400;
						color: #F66337;

						text {
							margin-left: 10rpx;
							font-size: 24rpx;
							font-family: PingFang SC;
							font-weight: 500;
							color: #F66337;
						}
					}
				}
			}
		}


	}

	.content {
		position: relative;
		z-index: 1;
		padding: 0 36rpx;

		.title {
			height: 106rpx;
			line-height: 106rpx;
			font-size: 32rpx;
			font-family: PingFang SC;
			font-weight: bold;
			color: #333333;
		}

		.list {
			margin: 0 auto 24rpx;
			background: #FFFFFF;
			width: 678rpx;
			border-radius: 20rpx;
			height: 340rpx;
			position: relative;
			display: flex;
			align-items: center;

			.img {
				margin: 0 24rpx;
				width: 84rpx;
				height: 84rpx;
			}

			.go {
				margin: 180rpx 18rpx 0 auto;
				width: 120rpx;
				height: 120rpx;
			}

			.con {
				.name {

					font-size: 40rpx;
					font-family: PingFang SC;
					font-weight: bold;
					color: #5B4D41;
					margin-bottom: 20rpx;
				}

				.text {
					font-size: 30rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #666666;
				}
			}
		}
	}

	page {
		background: #FAFAFA;
	}
</style>
